program example
use polymorphic_complextaylor
implicit none 
integer no,nv
type(complextaylor) f,df
complex(dp) c,cc


no=4; nv= 2;    ! no: the order of the polynomial    nv: the number of variables
call init(no,nv)  ! initializes taylor series without maps

call alloc(f,df)      ! must be constructed after init

c=cmplx(5.d0,-1.4d0,kind=dp)
cc=cmplx(6.d0,1.6d0,kind=dp)  

f=(c.mono.'12') + (cc.mono.'11') + 4.d0
  ! Creates 5.d0 x_1 x_ 2 ^2 - 1.4d0 i* x_1 x_ 2 ^2 + 6.d0 x_1x_2 + 1.6 i* x_1 x_ 2+4.d0
df=f.d.2       !      df/dx_2    Creates 10.d0 x_1 x_2 - 2.8d0 i* x_1 x_ 2 + 6.d0 x_1+ 1.6 i* x_1 

call print(f,6)
call print(df,6)

call kill(f,df)      ! must be destroyed
end program example



